package com.wzcl.app.model.vo;

import com.wzcl.app.dao.model.SysDict;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

@EqualsAndHashCode(callSuper = false)
@Data
public class SysDictVo extends BaseVo {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "系统名称")
    private String keyName;

    @ApiModelProperty(value = "描述")
    private String valueName;

    @ApiModelProperty(value = "属性")
    private List<SysDictInfoVo> sysDictInfoList;

    private SysDictVo() {
    }

    public static SysDictVo create(SysDict sysDict){
        SysDictVo sysDictVo = new SysDictVo();
        BeanUtils.copyProperties(sysDict,sysDictVo);
        sysDictVo.translationValueStr();
        if(sysDict.getInfoList()!=null && sysDict.getInfoList().size()>0){
            List<SysDictInfoVo> collect = sysDict.getInfoList().stream().map(SysDictInfoVo::create).collect(Collectors.toList());
            sysDictVo.sysDictInfoList = collect;
        }
        return sysDictVo;
    }

    @Override
    public void translationValueStr() {

    }

    @Override
    public void processResources() {

    }
}
